package com.example.mvptest.model;

import com.example.mvptest.present.OnCalcListener;

public class CalcModel {
	
	private OnCalcListener onCalcListener;
	
	public CalcModel(OnCalcListener onCalcListener) {
		this.onCalcListener = onCalcListener;
	}
	
	public void calc(double firtNum, double secondNum) {
		double result = doCalc(firtNum, secondNum);
		if (onCalcListener != null) {
			onCalcListener.showResult(result);
		}
	}
	
	private double doCalc(double firtNum, double secondNum) {
		return firtNum + secondNum;
	}
	
}
